

** Replication codes for "The Blame Game: Public Outcry and Terrorism Within and Exported from the Sanctioned State"

** Results produced by Stata v.17

** Last updated September 3, 2022  


use "BlameGame_FPA2022.dta", replace


*====== Hypothesis 1 ======

* Tabel 1 - Domestic Terrorist Attacks 
nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd, vce(cluster ccode)
estimates store m1

* summary table 
sum gtddomesticsandler usimposedur usthreatdur v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd if e(sample)==1
 
* check multicollinearity 
estpost cor  usimposedur usthreatdur v2x_freexp lnpop lngdp theta_mean polity2 internationalwar civilwar usidealdis countmids moveavegtd if e(sample)==1, matrix
esttab using correlation.rtf, replace unstack not noobs nonote b(3) 

* Figure 1 
estimates restore m1
margins, dydx(usimposedur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-imposition duration.png", replace

* Figure 2
margins, dydx(usthreatdur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Threat Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-threat duration.png", replace



*====== Hypothesis 2 ======

 ** Tabel 1 - Terrorist Attacks Against Americans by Target Nationals
nbreg F.iteratenatsum  c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids v2clfmove moveaveiterate , vce(cluster ccode) 
estimates store m2

outreg2 [m1 m2] using Table1, word replace alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

* summary table
sum iteratenatsum biusuniimposition biusunithreat usimposedur usthreatdur v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids v2clfmove moveaveiterate if e(sample)==1 
 

* Figure 3 
margins, dydx(usimposedur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H2-imposition duration.png", replace

margins, dydx(usthreatdur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Threat Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))




*====== Additional Tests ======

* Table A5 - duration of major and minor sanctions 	
nbreg F.gtddomesticsandler c.usmajorimposedur##c.v2x_freexp c.usminorimposedur##c.v2x_freexp  lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd, vce(cluster ccode)

estimates store m3

* Figure A1
margins, dydx(usmajorimposedur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Major Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-major sanction duration.png", replace	

* Figure A2
margins, dydx(usminorimposedur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Minor Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-minor sanction duration.png", replace


* Table A6 - selection model using inverse mills ratio
xi: probit biusunisanction l.lngdp l.theta_mean l.polity2 l.usidealdis l.countmids l.tradeofgdpnetrdgnfszs moveavegtd
outreg2 xi using selection, word replace alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 
predict EVENTPROB 
predict PROBITXB, xb
gen PDFPROBIT = normalden((PROBITXB))
gen CDFPROBIT = normprob(PROBITXB)
gen IMR = PDFPROBIT/CDFPROBIT
nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd IMR, vce(cluster ccode)
estimate store outcome
outreg2 outcome using outcome, word replace alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 


* Figure A3
margins, dydx(usimposedur) at((mean)_all v2x_freexp =(0(.1)1)) 
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-IMR-duration.png", replace


* Figure A4
nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean civilwar countmids usidealdis moveavegtd, vce(cluster ccode)
margins, dydx(usimposedur) at((mean)_all v2x_freexp =(0(.1)1)) vsquish level(95)
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Freedom of Expression (Low Freedom - High Freedom), size(medsmall)) ytitle(Marginal Effects of US Imposition Duration, size(medsmall)) ///
addplot(hist v2x_freexp if e(sample)==1, percent fcolor(none) lcolor(gray) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) ///
yline(0, lcolor(black))
graph export "H1-duration-without polity.png", replace


* Table A8
nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd F.iteratenatsum, vce(cluster ccode)
outreg2 using RRTable, word replace alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd L3.iteratenatsum, vce(cluster ccode)
outreg2 using RRTable, word  alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd moveaveiterate , vce(cluster ccode)
outreg2 using RRTable, word  alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

*for domestic attacks - replace moving average with lag moving average for years 2012 2013 2014
gen movingiterate2012constant = moveaveiterate
replace movingiterate2012constant = l.moveaveiterate if year==2012
replace movingiterate2012constant = l2.moveaveiterate if year==2013
replace movingiterate2012constant = l3.moveaveiterate if year==2014
tab year if movingiterate2012constant !=.

nbreg F.gtddomesticsandler c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids moveavegtd movingiterate2012constant , vce(cluster ccode)
outreg2 using RRTable, word  alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

nbreg F.iteratenatsum  c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids v2clfmove moveaveiterate F.gtddomesticsandler , vce(cluster ccode) 
outreg2 using RRTable, word  alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

nbreg F.iteratenatsum  c.usimposedur##c.v2x_freexp c.usthreatdur##c.v2x_freexp lnpop lngdp theta_mean c.polity2##c.polity2 internationalwar civilwar usidealdis countmids v2clfmove moveaveiterate moveavegtd , vce(cluster ccode) 
outreg2 using RRTable, word  alpha(0.01, 0.05, 0.1) symbol(***,**,*) bdec(3) 

